package com.my12306.common.util.quartz.job;

import com.google.gson.Gson;
import com.my12306.common.model.po.ScheduleJobPo;
import com.my12306.third.service.SmsService;
import com.my12306.third.util.SmsUtils;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author:苏牧夕
 * @Date:2020/5/28 0:18
 * @Version 1.0
 */
@Component("smsJob")
// TODO: 2020/5/29
public class SmsJob extends BaseJob {
    @Autowired
    SmsService smsService;
    @Autowired
    SmsUtils smsUtils;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        Gson gson = new Gson();
        Object data = context.getJobDetail().getJobDataMap().get("data");
        Object job = context.getJobDetail().getJobDataMap().get("job");

//        SmsVo smsVo = gson.fromJson(user1.toString(), SmsVo.class);
        System.out.println("SMS定时任务数据：" + data);
        System.out.println("SMS定时任务数据：" + gson.fromJson(job.toString(), ScheduleJobPo.class));
//        smsService.sendSms( content,user.getPhone(), SmsConstants.SMS_TEMPLATE_ID);

//        smsUtils.sendSms(new String[]{user.getPhone()}, new String[]{content}, "wan", SmsConstants.DRUGS_TEMPLATE_ID);

    }


}
